//
// Created by nicemoe on 2021/8/7.
//

#include  <iostream>
#include <cctype>

using namespace std;
/**
 * 字符串函数库cctype
 * @return
 */
int main()
{
    cout << "Enter text for analysis, and type @"
            "to terminate input. \t";
    char ch;
    int whitespace = 0;
    int digists = 0;
    int chars = 0;
    int punct = 0;
    int others = 0;

    cin.get(ch);
    while (ch != '@')
    {
        if (isalpha(ch)) chars++;
        else if (isspace(ch)) whitespace++;
        else if (isdigit(ch)) digists++;
        else if (ispunct(ch)) punct++;
        else others++;
        cin.get(ch);
    }
    cout << chars << " letters, "
         << whitespace << " whitespace, "
         << digists << " digists, "
         << punct << " punctuations,"
         << others << " others. \n";

    return 0;
}
